﻿@using Chaine
@model Chaine.Models.LogOnModel
<!DOCTYPE html>
<html>
<head>
    <title>Log In</title>
    <link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Content/themes/base/jquery-ui.css")" rel="Stylesheet"/ type="text/css">
    <link href="@Url.Content("~/Content/bootstrap.min.css")" rel="Stylesheet"/ type="text/css">
    <script src="@Url.Content("~/Scripts/jquery-1.7.2.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery-ui.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/bootstrap.min.js")" type="text/javascript"></script>
</head>
<body class="page-login">
    @using (Html.BeginForm())
    {
        <div id="login-form-container" class="fm-container">
            @if (TempData["validate-email"] != null)
            { 
                <div class="alert">
                    <button type="button" class="close" data-dismiss="alert">
                        ×</button>
                    The email confirming message has been sent to your email address @TempData["validate-email"].
                    Please check your email box. Thanks!
                </div>
            }
            @if (TempData["validate-email-failed"] != null)
            { 
                <div class="alert alert-error alert-block">
                    <button type="button" class="close" data-dismiss="alert">
                        ×</button>
                    <h4 class="alert-heading">
                        Account Activation</h4>
                    <p>
                        Your account has not been activated!</p>
                    <p>
                        Please click on the activation link provided in the sign-up confirmation email sent
                        to you previously and sign in again.
                    </p>
                </div>
            }
            @if (TempData["validate-email-success"] != null)
            {
                <div class="alert alert-success alert-block">
                    <button type="button" class="close" data-dismiss="alert">
                        ×</button>
                    <h4 class="alert-heading">
                        Email Validated</h4>
                    <p>
                        Your email has been validated.</p>
                </div>
            }
            @if (TempData["reset-password-success"] != null)
            {
                <div class="notice">
                    <h2>
                        New password has been sent to your email address: @TempData["reset-password-success"]
                    </h2>
                </div>
            }
            @if (ViewData.ModelState["IsChecked"].IsError())
            { 
                <div class="alert alert-error alert-block">
                    <button type="button" class="close" data-dismiss="alert">
                        ×</button>
                    <p>
                        Sorry, your application is not approved by administrator. If you are urgent to login
                        the system. Please contact the administrator by admin@chaineshanghai.org
                    </p>
                </div>
            }
            @if (ViewData.ModelState["IsEmailValidated"].IsError())
            { 
                <div class="alert alert-error alert-block">
                    <button type="button" class="close" data-dismiss="alert">
                        ×</button>
                    <p>
                        Sorry, your email address is not verified. Please check your email box. @Html.ActionLink("Click here", "ResendValidationEmail", new { id = TempData["RegisterID"] })
                        to RESEND the verification email.</p>
                </div>
            }
            @if (ViewData.ModelState["WrongUserNameOrPassword"].IsError())
            { 
                <div class="alert alert-error alert-block">
                    <button type="button" class="close" data-dismiss="alert">
                        ×</button>
                    <p>
                        The user name or password provided is incorrect.
                    </p>
                </div>
            }
            <div class="span5">
                <h1>
                    Chaine Shanghai</h1>
                <br />
                <div class="editor-label">
                    User Name
                </div>
                <div class="editor-field">
                    @Html.TextBoxFor(m => m.UserName)
                    @Html.ValidationMessageFor(m => m.UserName)
                </div>
                <div class="editor-label">
                    Password
                </div>
                <div class="editor-field">
                    @Html.PasswordFor(m => m.Password)
                    @Html.ValidationMessageFor(m => m.Password)
                </div>
                <div class="editor-label remember-me">
                    @Html.CheckBoxFor(m => m.RememberMe)
                    Remember me
                </div>
                <p class="login-btn-container">
                    <input type="submit" class="green" value="Login" />
                    or
                    @Html.ActionLink("Sign up now", "register")
                </p>
                <p>
                    @Html.ActionLink("Forget Password?", "ResetPassword")
                </p>
            </div>
            <hr class="hidden" />
        </div>
    }
</body>
</html>
